placesview: Set .error style if unsupported protocol
authorAntónio Fernandes <antoniof@gnome.org>
Sat, 24 Nov 2018 00:31:07 +0000 (00:31 +0000)
committerMatthias Clasen <mclasen@redhat.com>
Fri, 14 Dec 2018 17:28:47 +0000 (12:28 -0500)
When the user types an address with a schema that is not supported,
the Connect button doesn't become sensitive, but there is no visible
feedback at all.

This feels unresponsive and leaves the user clueless.

While it doesn't help explain why the address doesn't work, this will
provide a hint that the input was acknowledged but doesn't work.

https://gitlab.gnome.org/GNOME/gtk/issues/1476

gtk/gtkplacesview.c

index 693a28e3b3a35cf5195434d888f3c8003f779099..be0a84ab15584cb4d5fd99af30b67575d252a9a8 100644 (file)
@@ -1809,6 +1809,13 @@ on_address_entry_text_changed (GtkPlacesView *view)
 
 out:
   gtk_widget_set_sensitive (priv->connect_button, supported);
+  if (scheme && !supported)
+    gtk_style_context_add_class (gtk_widget_get_style_context (priv->address_entry),
+                                 GTK_STYLE_CLASS_ERROR);
+  else
+    gtk_style_context_remove_class (gtk_widget_get_style_context (priv->address_entry),
+                                    GTK_STYLE_CLASS_ERROR);
+
   g_free (address);
   g_free (scheme);
 }